home *** CD-ROM | disk | FTP | other *** search
MarxMenu script | 1990-06-30 | 1.2 KB | 82 lines |
- Comment
- ================================================
-
- This example shows the use of arrays.
- Type MarxMenu Mult to run.
-
- You'll notice that you don't need to declare the
- size or dimensions of the array.
-
- ================================================
- EndComment
-
- ClearScreenOnExit Off
- StandardIO
-
- Var
- TableA
- TableB
-
- ShowMemory
-
- ;------ Create the multiplication table in the Array.
-
- MakeTable (9,9)
-
- ;------ You can copy an array in the following manner
-
- TableB = TableA
-
- Writeln 'Arrays Allocated'
-
- ShowMemory
-
- Writeln 'Multiplication Table:'
- Writeln
-
- ;------ Print the table from the Array.
-
- PrintTable (9,9,TableB)
-
- Dispose TableA
- Dispose TableB
-
- Writeln
- Writeln 'Arrays DeAllocated'
-
- ShowMemory
-
- ;------ Subroutines
-
- Procedure ShowMemory
- var X
- X = 1
- Writeln 'Free Memory: ' FreeMemory
- Writeln
- EndProc
-
-
- Procedure MakeTable (X,Y)
- var A
- Loop Y
- A = LoopIndex
- Loop X
- TableA[A,LoopIndex] = A * LoopIndex
- EndLoop
- EndLoop
- EndProc
-
-
- Procedure PrintTable (X,Y,Table)
- var A
- Loop Y
- A = LoopIndex
- Loop X
- if Table[A,LoopIndex] < 10 then Write ' '
- Write ' ' Table[A,LoopIndex]
- EndLoop
- Writeln
- EndLoop
- EndProc
-